user_info = dict({'zwx':'123','root':'456'})
username = None
userpwd = None
def login_required(func):
    def inner():
        if username == None and userpwd == None:
            print("您还未登录，请先登录")
            global username1
            global userpwd1
            username1 = input("请输入用户名：")
            userpwd1 = input("请输入密码：")
            for key in user_info:
                if username1 == key and userpwd1 == user_info[key]:
                    print("登录成功！")
                    break
                else:
                    print("用户名或密码有误，请重新输入")
        return func()
    return inner
def permision_allowed(func):  #传入函数
        def inner():
            if username1 == "root":
                print("欢迎登录")
                func()
            else:
                print("权限不够")

        return inner

@login_required
@permision_allowed
def func1():
    print("执行func1函数")
func1()
